<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>setTimeout</title>  
</head>  
<body>  
   <!--  <form id="form1" >  
        <div id='div1'>  
        </div>  
    </form>   -->
    <div id="orderTime"></div>
</body>  
</html>  
  
  
<script type="text/javascript">  
 //设定倒数秒数  
var t = 120;  


//显示倒数秒数  
/*  function showTime(){  
	 t -= 1; 
    var m = Math.floor(t/60);//转换成分钟
    alert(m);
    var s = t%60;//余数是秒
   alert(s);
    document.getElementById('div1').innerHTML= m+'minutes'+s+'seconds';  
    if(t==0){  
        location.href='http://www.baidu.com';  
    }  
    //每秒执行一次,showTime()  
    setTimeout("showTime()",1000);   
   }  */
    var totalTime =900;
	   function showTime(){
		   totalTime -= 1;
		   var m = Math.floor(totalTime/60);
		   var s = totalTime%60;
		   document.getElementById('orderTime').innerHTML= '<font size="12px">请于'+m+'m'+s+'s之内完成支付'+'</font>';
		   if(totalTime==0){
			   //订单失效
			     //1.更新订单信息
			      //2.更改订单状态
			      //3.弹出框进行提示
		   }
		   setTimeout("showTime()",1000);
	   }  
 
  
  
//执行showTime()  
showTime();  
</script>  